﻿using System.Collections;
using GameCreator.Core;
using GameCreator.Messages;
using GP.Scripts.City;
using Gp.Scripts.Core;
using GP.Scripts.GUI;
using UnityEngine;

namespace Gp.Scripts.Core {
    public class BasicLuaRegister : LuaRegister{
        [LuaFunction("SendEvent", "Exec", "Exe", "Ex", "执行")]
        private static void Execute(string message) {
            SceneScriptArchitecture.Interface.SendEvent(new SceneScriptEvent(message));
        }


        [LuaFunction("Msg")]
        private static void Message(string message) {
            CoroutinesManager.Instance.StartCoroutine(Process());

            IEnumerator Process() {
                SimpleMessageManager.Instance.ShowText(message, Color.white);
                yield return new WaitForSeconds(2);
                SimpleMessageManager.Instance.HideText();
            }
        }
        
        
    }
    
}